package com.saas.after.job.entity;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;

import javax.persistence.*;
import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * @Author: hjchen
 * @Contact: afterchj@foxmail.com
 * @Date: 2020/12/21 13:49
 */
@Data
@MappedSuperclass
public class BaseEntity implements Serializable {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    @Column(columnDefinition = "DATETIME COMMENT '创建时间'")
    @TableField(fill = FieldFill.INSERT)
    private LocalDateTime gmtCreate;

    @Column(columnDefinition = "DATETIME COMMENT '修改时间'")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime gmtModified = LocalDateTime.now();
}
